package org.kfive.nova;

import com.alibaba.druid.support.json.JSONUtils;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import com.google.common.io.LineProcessor;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.BitSet;
import java.util.Date;
import java.util.List;
import java.util.Optional;

import org.kfive.nova.test.Person;
import org.kfive.nova.test.Son;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        /*try {
            String line = Files.asCharSource(new File("D://gib.log"), Charsets.UTF_8).readLines(new LineProcessor<String>() {
                @Override
                public boolean processLine(String line) throws IOException {
                    return false;
                }

                @Override
                public String getResult() {
                    return null;
                }
            });
            System.out.println(line);
        } catch (IOException e) {
            e.printStackTrace();
        }
        Function<String,Integer> fun = new Function<String, Integer>() {
            @Override
            public Integer apply(String input) {
                return input.length();
            }
        };
        Ordering.natural().*/
        //Person person = new Person();
        //System.out.println(person instanceof Son);
//        Ordering.natural().
        /*LocalDate amoStartDate = LocalDate.of(2020,10,1);
        YearMonth amoYearMonth = YearMonth.of(2017,9);
        long months = java.time.Period.between(amoStartDate,amoYearMonth.atDay(1)).toTotalMonths();
        System.out.println("months="+months);

        Optional<Date> amoDateStart = Optional.ofNullable(new Date());
        Optional<Date> conDateStart = Optional.ofNullable(null);
        Date result = amoDateStart
            .map(ads -> conDateStart
                .map(cds -> ads.after(cds) ? ads : cds)
                .orElse(null))
            .orElse(null);
        System.out.println(result);*/
        //System.out.printf(String.format("%s-'('%s')'","级别","H"));
//        String result = CharMatcher.digit().retainFrom("aaa_1");
//        System.out.println(result);
        /*List<String> testList = Lists.newArrayList("ids");
        System.out.println(testList.contains("id"));
        Character character = new Character('*');
        System.out.printf(character.toString());*/
//        String fieldName = "rangeName";
//        String[] arr = fieldName.split("\\.");
//        System.out.println(fieldName.split("\\."));
//        System.out.println(fieldName.substring(fieldName.indexOf(".")+1));
//        LocalDate firstDate = LocalDate.of(2012,05,01);
//        LocalDateTime endDate = firstDate.with(TemporalAdjusters.lastDayOfMonth()).atStartOfDay();
//        System.out.println(firstDate.format(DateTimeFormatter.ofPattern("yyyyMMdd HHss")));

        //String moments_approval = Hashing.md5().newHasher().putString("report_approval", Charset.forName("utf-8"))
        //    .hash().toString();
        //System.out.println(moments_approval);
        BitSet bitSet = new BitSet();
        bitSet.set(0);
        bitSet.set(1);
        bitSet.set(2);
        boolean c = bitSet.get(0);
        System.out.printf(""+c);
    }
}
